package org.xteam.sled.tree;

import java.util.ArrayList;
import java.util.List;

import org.xteam.sled.model.AbsoluteField;

public class LRTokensFieldStrategy extends FieldStrategy {

	@Override
	public List<AbsoluteField> limitFields(List<AbsoluteField> afields) {
		List<AbsoluteField> good = new ArrayList<AbsoluteField>();
		int offset = -1;
		for (AbsoluteField af : afields) {
			int k = af.offset();
			if (offset < 0 || offset >= k) {
				if (offset > k)
					good.clear();
				good.add(af);
				offset = k;
			}
		}
		return good;
	}

}
